package com.cysyz.mylib.dao.type;

/**
 * dao的类型枚举类，需要首先配置Object.typeResolver才能正常进行使用
 */
public enum Type {
    LONG {
        @Override
        public Object getRealType() {
            return typeResolver.getLong();
        }
    },
    INTEGER{
        @Override
        public Object getRealType() {
            return typeResolver.getInteger();
        }
    },
    SHORT{
        @Override
        public Object getRealType() {
            return typeResolver.getShort();
        }
    },
    BYTE{
        @Override
        public Object getRealType() {
            return typeResolver.getByte();
        }
    },
    FLOAT{
        @Override
        public Object getRealType() {
            return typeResolver.getLong();
        }
    },
    DOUBLE{
        @Override
        public Object getRealType() {
            return typeResolver.getDouble();
        }
    },
    CHARACTER{
        @Override
        public Object getRealType() {
            return typeResolver.getChar();
        }
    },
    STRING{
        @Override
        public Object getRealType() {
            return typeResolver.getString();
        }
    },
    TIME{
        @Override
        public Object getRealType() {
            return typeResolver.getTime();
        }
    },
    DATE{
        @Override
        public Object getRealType() {
            return typeResolver.getDate();
        }
    },
    TIMESTAMP{
        @Override
        public Object getRealType() {
            return typeResolver.getTimestamp();
        }
    },
    BINARY{
        @Override
        public Object getRealType() {
            return typeResolver.getBinary();
        }
    },
    TEXT{
        @Override
        public Object getRealType() {
            return typeResolver.getText();
        }
    },
    BLOB{
        @Override
        public Object getRealType() {
            return typeResolver.getBlob();
        }
    },
    CLOB{
        @Override
        public Object getRealType() {
            return typeResolver.getClob();
        }
    };
    private static TypeResolver typeResolver;

    public static void setTypeResolver(TypeResolver typeResolver) {
        Type.typeResolver = typeResolver;
    }

    public abstract Object getRealType();
}
